package com.handu.luna.mall.controller;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;

import com.handu.luna.core.domain.Page;

public class MallModelView extends ModelAndView{
	
	protected Log logger = LogFactory.getLog(this.getClass());
	
	public MallModelView(){
		
	}
	
	@SuppressWarnings("rawtypes")
	public MallModelView add(String attributeName,Object attributeValue){
		if(attributeName != null && attributeValue!= null){ 
			if(attributeValue.getClass().getName() == org.springframework.data.domain.PageImpl.class.getName()){
				this.addObject(attributeName, new Page((org.springframework.data.domain.Page)attributeValue));
			}
			else{
				this.addObject(attributeName, attributeValue);
			}
		}else{
			logger.debug("attributeName or attributeValue is null when add it to BossModel");
		}
		return this;
	}
}
